import http from '@/utils/http.js';

/**
 * 获取短信验证码
 * @param {Object} data
 * @returns
 */
export function getSmsCodeApi(data) {
  return http({
    url: '/member/auth/send-sms-code',
    method: 'post',
    data: data
  });
}

/**
 * 获取邮箱验证码
 * @param {Object} data
 * @returns
 */
export function getEmailCodeApi(data) {
  return http({
    url: '/member/auth/send-email-code',
    method: 'post',
    data: data
  });
}

/**
 * 邮箱注册
 * @param {Object} data
 * @returns
 */
export function registerEmailApi(data) {
  return http({
    url: 'member/auth/registerByMail',
    method: 'post',
    data: data
  });
}

/**
 * 手机号注册
 * @param {Object} data
 * @returns
 */
export function registerMobileApi(data) {
  return http({
    url: '/member/auth/registerByMobile',
    method: 'post',
    data: data
  });
}

/**
 * 手机号重置密码
 * @param {Object} data
 * @returns
 */
export function resetPasswordMobileApi(data) {
  return http({
    url: '/member/user/reset-password',
    method: 'post',
    data: data
  });
}

/**
 * 邮箱号重置密码
 * @param {Object} data
 * @returns
 */
export function resetPasswordEmailApi(data) {
  return http({
    url: '/member/user/reset-passwordByMail',
    method: 'post',
    data: data
  });
}
/**
 * 账号密码登录
 * @param {Object} data
 * @returns
 */
export function loginApi(data) {
  return http({
    url: '/member/auth/login',
    method: 'post',
    data: data
  });
}

/**
 * 获取微信登陆二维码地址
 * @param {Object} params {url : String(重定向url)，type : String(类型，默认web)}
 * @returns
 */
export function getWechatQrCodeApi(params) {
  return http({
    url: '/member/auth/social-auth-redirect',
    method: 'get',
    params: params
  });
}

/**
 * 微信扫码登陆
 * @param {Object} params {code : String(微信返回code)}
 * @returns
 */
export function wechatLoginApi(data) {
  return http({
    url: '/member/auth/social-login',
    method: 'post',
    data
  });
}
